import request from '../../utils/request'
import { TSystemPage } from '../../Types/system'

// 获取系统页面列表
export const getSystemPages = () => request.get('/public/page')

// 获取指定页面列表
export const getSystemPageBySpecific = (data: any) => request.post(`/public/page`, data)

// 添加系统页面
export const addSystemPage = (data: TSystemPage) => request.post('/public/page/add', data)

// 更新系统页面
export const updateSystemPage = (data: TSystemPage) => request.put('/public/page', data)

// 删除系统页面
export const deleteSystemPage = (id: number) => request.delete(`/public/page/${id}`)

// 更新页面状态
export const updatePageEnabled = (data: { id: number; isEnabled: number }) =>
	request.put(`/public/page`, data)

// 更新页面允许访问的用户
export const updatePageAllowUser = (data: { id: number; allowUser: string }) =>
	request.put(`/public/page`, data)
